/**************************************************************************
** Qt Creator license header template
**   Special keywords: Programmer 2012/5/10 2012
**   Environment variables: 
**   To protect a percent sign, use '%'.
**************************************************************************/

#include "simplestfilter.h"

SimplestFilter::SimplestFilter(QObject *parent) :
    QObject(parent),MeshFilterInterface()
{

    typeList << FP_VERT
             << FP_FACE
             << FP_COLOR
             << FP_NORM
             << FP_TEXCOORD;

    FilterIDType tt;
    foreach(tt,typeList){
        actionList << new QAction(filterName(tt),this);////////////////////////////
    }
}

QString SimplestFilter::filterName(FilterIDType filter) const
{
    switch(filter){
    case FP_VERT: return tr("Vertex: to do");
    case FP_FACE: return tr("Face : to do");
    case FP_COLOR: return tr("Color : to do");
    case FP_NORM: return tr("Normal : to do");
    case FP_TEXCOORD: return tr("Texture coordinate : to do");
    default: assert(0);
    }
    return tr("");
}

QString SimplestFilter::filterInfo(FilterIDType filter) const
{
    switch(filter){
    case FP_VERT: return tr("explain what to do with vertex");
    case FP_FACE: return tr("explain what to do with face");
    case FP_COLOR: return tr("explain what to do with color");
    case FP_NORM: return tr("explain what to do with normal");
    case FP_TEXCOORD: return tr("explain what to do with texture coordinate");
    default: assert(0);
    }
    return tr("");
}

MeshFilterInterface::FilterClass SimplestFilter::getClass(QAction *a)
{
    //add all the actions to submenu "Camera"
    switch(ID(a)){
    case FP_VERT:
    case FP_FACE:
    case FP_COLOR:
    case FP_NORM:
    case FP_TEXCOORD: return MeshFilterInterface::Camera;
    default: assert(0);
    }
    return MeshFilterInterface::Generic;
}

void SimplestFilter::initParameterSet(QAction *a, MeshModel &, RichParameterSet &parLst)
{
    //define the dialog to be showed when the respective action is triggered.
    switch(ID(a)){
    case FP_VERT: parLst.addParam(new RichBool(tr("isChecked"),true,tr("description to this control"),tr("aa")));
        break;
    case FP_FACE: parLst.addParam(new RichInt(tr("Integer"),19,tr("description..."),tr("tool tip")));
        break;
    case FP_COLOR: parLst.addParam(new RichFloat(tr("FLOAT"),3.555,tr("description"),tr("tool tip")));
        break;
    case FP_NORM: parLst.addParam(new RichMatrix44f(tr("Matrix"),vcg::Matrix44f::Identity(),tr("description"),tr("tool tip")));
        break;
    case FP_TEXCOORD: parLst.addParam(new RichDynamicFloat(tr("DynamicFloat"),0.0,-100.0,100.0,tr("description"),tr("tool tip")));
        break;
    default: assert(0);

    }

}

bool SimplestFilter::applyFilter(QAction *filter, MeshDocument &md, RichParameterSet &par, vcg::CallBackPos *cb)
{
    switch(ID(filter)){
    case FP_VERT:
        break;
    case FP_FACE:
        break;
    case FP_COLOR:
        break;
    case FP_NORM:
        break;
    case FP_TEXCOORD:
        break;
    default: assert(0);
    }

}

//int SimplestFilter::getPreConditions(QAction *) const{}
int SimplestFilter::postCondition(QAction *) const{}


Q_EXPORT_PLUGIN(SimplestFilter)
